<!--
 * @Description: 会议大屏
 * @Author: wind-lc
 * @version: 1.0
 * @Date: 2021-08-06 16:14:40
 * @LastEditTime: 2021-08-06 17:20:54
 * @FilePath: \cscec-pms-admin\src\components\ConferenceScreen\index.vue
-->
<template>
  <a-button
    type="primary"
    :loading="loading"
    @click="handleLargeScreen"
  >
    会议大屏
  </a-button>
</template>
<script>
export default {
  name: 'Index',
  props: {
    id: {
      type: String,
      require: true
    },
    meetingScreen: {
      type: Function,
      require: true
    }
  },
  components: {},
  data() {
    return {
      //加载
      loading: false
    }
  },
  methods: {
    /**
     * @description: 打开大屏
     * @param {void}
     * @return {void}
     */
    async handleLargeScreen() {
      try {
        this.loading = true
        const {
          data: { meetingName, branchComName, projectName, meetingPlace, startTime, orCode }
        } = await this.meetingScreen({ id: this.id })
        const routeData = this.$router.resolve({
          path: '/conferenceScreen',
          query: {
            meetingName,
            branchComName,
            projectName,
            meetingPlace,
            startTime,
            orCode
          }
        })
        window.open(routeData.href, '_blank')
      } catch (error) {
        console.log(error)
      } finally {
        this.loading = false
      }
    }
  }
}
</script>
<style lang="less" scoped>
</style>
